var _tools = require("../../../utils/tools.js"), _tools2 = _interopRequireDefault(_tools);

function _interopRequireDefault(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var that, app = getApp();
let interstitialAd = null;

Page({
    data: {
        share_text: "",
        share_image: ""
    },
    onLoad: function(t) {
        that = this;
    },
    onReady: function() {
        wx.setNavigationBarColor({
            frontColor: "#000000",
            backgroundColor: "#000000"
        });
        var t = {
            action: "shop",
            contr: "sign",
            token: wx.getStorageSync("token")
        };
        _tools2.default.request(t, function(t) {
            that.setData(t.info);
        });
    },
    onShow: function() {
        if (wx.createInterstitialAd) {
            interstitialAd = wx.createInterstitialAd({
              adUnitId: 'adunit-42e141bfcfdcc315'
            })
            interstitialAd.onLoad(() => {})
            interstitialAd.onError((err) => {})
            interstitialAd.onClose(() => {})
          };
          
          // 在适合的场景显示插屏广告
          if (interstitialAd) {
            interstitialAd.show().catch((err) => {
              console.error(err)
            })
          };
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        return {
            title: this.data.share.text,
            imageUrl: this.data.share.images,
            path: "bh_bargain/pages/index/index?parent_id=" + this.data.share.member_id
        };
    },
    goodsDetails: function(t) {
        var e = t.currentTarget.dataset.id;
        if (2 != t.currentTarget.dataset.etype) wx.navigateTo({
            url: "/bh_bargain/pages/integral_goods/integral_goods?id=" + e
        }); else {
            var a = t.currentTarget.dataset.relationid;
            wx.navigateTo({
                url: "/bh_bargain/pages/pdd_details/pdd_details?id=" + e + "&pdd_id=" + a
            });
        }
    }
});